package top.infopub.mgr.mkt.web;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import top.infopub.enums.mkt.ProProcesssStatusEnum;
import top.infopub.enums.mkt.StandardEnum;
import top.infopub.enums.sg.CoopInfoTypesEnums;
import top.infopub.mgr.common.page.ParamPage;
import top.infopub.mgr.common.vo.ErrorCodeEnum;
import top.infopub.mgr.common.vo.RspVo;
import top.infopub.mgr.flow.service.ProcessService;
import top.infopub.mgr.flow.web.GenericFlowController;
import top.infopub.mgr.hr.service.StaffInfoService;
import top.infopub.mgr.hr.service.StaffOfficeService;
import top.infopub.mgr.hr.vo.StaffOfficeVo;
import top.infopub.mgr.mkt.domain.CollectDomain;
import top.infopub.mgr.mkt.domain.ProjectDomain;
import top.infopub.mgr.mkt.jsonvo.CollectJsonVo;
import top.infopub.mgr.mkt.service.*;
import top.infopub.mgr.mkt.vo.CollectProjectVo;
import top.infopub.mgr.mkt.vo.CollectionInfoVo;
import top.infopub.mgr.mkt.vo.InvestmentInfoVo;
import top.infopub.mgr.sg.service.CitySurveyService;
import top.infopub.mgr.sg.service.CoopInfoService;
import top.infopub.mgr.sg.vo.CitySurveyVo;
import top.infopub.mgr.sys.service.LocationAreaDataService;
import top.infopub.mgr.sys.service.OperatorService;
import top.infopub.mgr.util.DateUtils;
import top.infopub.mgr.util.FirstSpellUtil;
import top.infopub.model.flow.Process;
import top.infopub.model.hr.StaffInfo;
import top.infopub.model.mkt.*;
import top.infopub.model.sg.CoopInfo;
import top.infopub.model.sys.Area;
import top.infopub.model.sys.City;
import top.infopub.model.sys.Operator;
import top.infopub.model.sys.Province;
import top.infopub.security.util.SessionUserUtils;
import top.infopub.security.vo.AuthorizationVO;
import top.infopub.tdp.sys.service.CodeGeneratorConfigService;
import top.infopub.util.IdFactory;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * 项目信息收集管理
 */
@Controller
@RequestMapping("/collectProject")
public class CollectProjectController  extends GenericFlowController {

    @Autowired
    private StaffInfoService staffInfoService;

    @Autowired
    private StaffOfficeService staffOfficeService;

    @Autowired
    private CoopInfoService coopInfoService;

    @Autowired
    private CollectProjectService collectProjectService;

    @Autowired
    private CodeGeneratorConfigService codeGeneratorConfigService;

    @Autowired
    private CitySurveyService citySurveyService;

    @Autowired
    private BaseLineService baseLineService;

    @Autowired
    private ProjectInfoService projectInfoService;

    @Autowired
    private AfterSummaryCoopService afterSummaryCoopService;

    @Autowired
    private ProjectRiskService projectRiskService;

    @Autowired
    private OperatorService operatorService;

    @Autowired
    private LocationAreaDataService locationAreaDataService;

    @Autowired
    private ProProcessManageService proProcessManageService;

    @Autowired
    private ProcessService processService;
    @Autowired
    private ProTrackService proTrackService;


    @RequestMapping("/list")
    public String list() {
        return "mkt/lay-collectProject-list";
    }

    /**
     * 项目信息收集列表数据
     * @return
     */
    @RequestMapping("/queryDataByCondition")
    @ResponseBody
    public RspVo<ProjectDomain> queryDataByCondition(CollectProjectVo collectProjectVo,
                                                     ParamPage paramPage) {
        Page<ProjectDomain> page = new Page<ProjectDomain>();
        page.setPageNum(paramPage.getPage());
        page.setPageSize(paramPage.getLimit());
        page = collectProjectService.selectPageByDomainWhere(page, collectProjectVo);
        return RspVo.getSuccessResponse(page.getTotal(), page.getResult());
    }

    /**
     * 项目信息收集-新增
     * @return
     */
    @RequestMapping("/add")
    public String add(HttpServletRequest request) {
        String bindOrgId = (String) SessionUserUtils.getSessionAttribute("bindOrgId");
        String bindOrgName = (String)SessionUserUtils.getSessionAttribute("bindOrgName");
        request.setAttribute("areaFirstSpell", FirstSpellUtil.two(bindOrgName));
        //查询有效的营销经理记录
        List<StaffOfficeVo> staffOfficeVos = staffOfficeService.selectActiveByOrgId(bindOrgId);
        request.setAttribute("staffOfficeVos", staffOfficeVos);
        //查询可用的联合体单位记录
        CoopInfo coopInfo = new CoopInfo();
        coopInfo.setState(1);
        coopInfo.setTypes("1");
        List<CoopInfo> coopInfos = coopInfoService.selectByEntityWhere(coopInfo);
        request.setAttribute("coopInfos", coopInfos);
        return "mkt/lay-collectProject-add";
    }
    /**
     * 根据id查询项目信息收集详情  > 注意：方法命名必须为：toDealOrDetail
     * @param id 项目信息收集Id
     * @return
     * @see
     */
    @RequestMapping("/toDealOrDetail")
    public String queryById(HttpServletRequest request, String id, String proCode) {
        //台账页面跳转页面
        CollectProject collectProject1 = collectProjectService.selectByProCodeStatus(proCode);
        if (collectProject1!=null){
            id=collectProject1.getId();
        }
        AuthorizationVO vo = SessionUserUtils.getSessionAttributeForUserDtl();
        request.setAttribute("id",id);
        CollectProject collectProject = collectProjectService.selectByPrimaryKey(id);
        ProTrack proTrack = new ProTrack();
        if(collectProject!=null){
             proTrack = proTrackService.selectByProCode(collectProject.getProCode());
        }
        request.setAttribute("isAuditFlag", "1");
        request.setAttribute("showFlag","0"); //默认不展示
        if (proTrack != null) {
            if (StringUtils.equals(ProProcesssStatusEnum.PRO_STATUS1.getCode(), proTrack.getProcessStatus())) {
                request.setAttribute("isAuditFlag", "0");
            }
            if (StringUtils.isNotBlank(proTrack.getProcessId()) && proTrack.getProcessId().length() > 10) {
                request.setAttribute("processId", proTrack.getProcessId());
                Process process = processService.selectByPrimaryKey(proTrack.getProcessId());
                ProjectInfo byProCode = projectInfoService.findByProCode(proTrack.getProCode());
                if (process.getMaxIdx()>2 && "1".equals(byProCode.getIsTrack())){
                    request.setAttribute("showFlag","1");//节点大于两个并且已终止跟踪 只展示
                }else if(process.getMaxIdx()==2){
                        request.setAttribute("showFlag","2"); //节点只有两个 可选
                }
                String auditTabFlag = proProcessManageService.checkShowAuditTab(proTrack.getProcessId(), vo);
                if (StringUtils.equals(ProProcesssStatusEnum.PRO_STATUS1.getCode(), proTrack.getProcessStatus())
                        && StringUtils.equals("0", auditTabFlag)) {
                    request.setAttribute("isAuditFlag", "0");
                }
                request.setAttribute("auditTabFlag", auditTabFlag);
            }
        }
        request.setAttribute("proCode",proCode);
        Set<Province> provinces = locationAreaDataService.selectProvincesAndsort();
        request.setAttribute("provinces", provinces);
        return "mkt/lay-collectProject-add";
    }

    /**
     * 根据id查询预立项详情  > 注意：方法命名必须为：toDealOrDetail
     * @param id 预立项Id
     * @return
     * @see
     */
    @RequestMapping("/toPreProjectDetail")
    public String queryByIdd(HttpServletRequest request, String id, String proCode) {
        request.setAttribute("id",id);
        request.setAttribute("proCode",proCode);
        return "mkt/lay-preProject-detail";
    }

    /***
     *
     * 项目信息收集详情
     * ***/
    @RequestMapping("/queryCollectDetail")
    @ResponseBody
    public RspVo querySetupDetail(String id) {
        //项目详情信息
        CollectJsonVo collectJsonVo = collectProjectService.queryDetailById(id);
        return RspVo.getSuccessResponse(collectJsonVo);
    }

       /**  * 新增获取合作方下拉框数据
     * ***/
    @RequestMapping("/getDrop")
    @ResponseBody
    public RspVo getDrop() {
        List<CoopInfo> coopInfoList = coopInfoService.queryByTypes(CoopInfoTypesEnums.OWNER, 1);
       CollectJsonVo collectJsonVo = new CollectJsonVo();
        collectJsonVo.setCoopInfoList(coopInfoList);
        return RspVo.getSuccessResponse(collectJsonVo);
    }

    /**
     * 获取省市区信息
     * **/
    @RequestMapping("/getAddress")
    @ResponseBody
    public RspVo getAddress(String id) {
        if ("0".equals(id)) { //获取省信息
            Set<Province> provinces = locationAreaDataService.selectProvincesAndsort();
            return RspVo.getSuccessResponse(provinces);
        }
        String[] split = id.split(",");
        if ("1".equals(split[1])){ //省获取市
            Set<City> citys = locationAreaDataService.selectCitysByProvIdAndSort(split[0]);
            return RspVo.getSuccessResponse(citys);
        }else {  //市获取县
            Set<Area> areas = locationAreaDataService.selectAreasByCityIdAndSort(split[0]);
            return RspVo.getSuccessResponse(areas);
        }
    }

    /**
    /**
     * 新增项目信息收集
     * @return
     */
    @SuppressWarnings({"rawtypes"})

    @RequestMapping(value = "/save",method = RequestMethod.POST)
    @ResponseBody
    public RspVo save(HttpServletRequest request, String bodyStr, Integer submitType){
        AuthorizationVO userDtl = SessionUserUtils.getSessionAttributeForUserDtl();
//        String procode = codeGeneratorConfigService.generatorCode("mkt_pre_project_procode");
        String s = StringEscapeUtils.unescapeJava(bodyStr);
        CollectionInfoVo vo = JSON.parseObject(s,CollectionInfoVo.class);
        String proCode = vo.getProjectInfo().getProCode();
        if (vo.getId()==null){
            //后续校验项目名称是否存在
            ProjectInfo projectInfo1 = projectInfoService.selectByProName(vo.getProjectInfo().getProName());
            if (projectInfo1!=null){
                return ErrorCodeEnum.ERROR_COMMON_SAVE.getRspVo("项目名称【" + vo.getProjectInfo().getProName()
                        + "】已经存在~");
            }
        }

        /***
         * 处理项目基础信息
         */
        ProjectInfo projectInfo = new ProjectInfo();
        CollectProject collectProject = new CollectProjectVo();
            //更新项目基础信息
            ProjectInfo byProCode = projectInfoService.findByProCode(vo.getProjectInfo().getProCode());
            if (byProCode!=null){
                BeanUtils.copyProperties(vo.getProjectInfo(),projectInfo);
            }else{
                BeanUtils.copyProperties(vo.getProjectInfo(),projectInfo);
//                projectInfo.setId(IdFactory.getUUIDUpper());
                projectInfo.setProCode(proCode);
                //查询城市调研信息ID ---待写
                CitySurveyVo citySurveyVo = new CitySurveyVo();
                citySurveyVo.setRefProvinceId(vo.getProjectInfo().getRefProvinceId());
                citySurveyVo.setRefCityId(vo.getProjectInfo().getRefCityId());
                if (StringUtils.isNotBlank(vo.getProjectInfo().getRefAreaId())){
                    citySurveyVo.setRefAreaId(vo.getProjectInfo().getRefAreaId());
                }
                String id = citySurveyService.selectByAddressId(citySurveyVo);
                projectInfo.setSgCityId(id);
//                projectInfo.setSgCityId("0000");
                projectInfo.setAddBy(userDtl.getId());
                projectInfo.setAddTime(DateUtils.getCurrentDateTime());
                projectInfo.setUptBy(userDtl.getId());
                projectInfo.setIsTrack("0"); //默认继续跟踪
                projectInfo.setUptTime(DateUtils.getCurrentDateTime());
                //查询所属公司id
                Operator operator = operatorService.selectById(userDtl.getId());
                StaffInfo staffInfo = staffInfoService.selectByPrimaryKey(operator.getHrStaffId());
                projectInfo.setHrOrgId(staffInfo.getPkOrg());
                projectInfo.setHrStaffMktId(userDtl.getId());

                List<InvestmentInfoVo> investmentInfoVos = vo.getInvestmentInfoVos();
                BigDecimal rowSum = BigDecimal.ZERO;
                for (InvestmentInfoVo investmentInfoVo : investmentInfoVos) {
                    if (StandardEnum.GET_JIANAN.getBaseLineName().equals(investmentInfoVo.getName())
                    ){
                        rowSum = investmentInfoVo.getTotal();
                    }
                }
                projectInfo.setSumCae(rowSum);  //建安总费用
                //实施机构
                List<AfterSummaryCoop> summary = vo.getSummary();
                for (AfterSummaryCoop afterSummaryCoop : summary) {
                    if ("2".equals(afterSummaryCoop.getCooperationType())){
                        projectInfo.setCarryOrg(afterSummaryCoop.getSgCoopId());
                    }
                }

                //更新项目信息收集信息
                collectProject.setId(IdFactory.getUUIDUpper());
                collectProject.setProCode(proCode);
                collectProject.setCodes("1");
                collectProject.setProcessId("1");
                collectProject.setProcessStatus(null); //默认为空
                collectProject.setAddBy(userDtl.getId());
                collectProject.setAddTime(DateUtils.getCurrentDateTime());
                collectProject.setUptBy(userDtl.getId());
                collectProject.setUptTime(DateUtils.getCurrentDateTime());
            }

        /**
         * 处理合作方
         * */
        int i = 0;
        List<AfterSummaryCoop> summary = vo.getSummary();
        for (AfterSummaryCoop afterSummaryCoop : summary) {
            if ("1".equals(afterSummaryCoop.getCooperationType())){
                i++;
            }
        }
        if (i>1){
            return RspVo.getFailureResponse(400, "只能选择一个居间方");
        }

        /**
         *    处理项目投资构成信息
         * */
        StringBuffer rowTotal = new StringBuffer();
        StringBuffer colTotal = new StringBuffer();
        ProjectSubInfo projectSubInfo = new ProjectSubInfo();
        //子项名称json字符串
        String itemName = JSON.toJSONString(vo.getItemName());
        //表格数据json字符串
        String investmentInfo = JSON.toJSONString(vo.getInvestmentInfoVos());
        //行和列数据合计数据收集
        List<InvestmentInfoVo> investmentInfoVos = vo.getInvestmentInfoVos();
        for (InvestmentInfoVo investmentInfoVo : investmentInfoVos) {
            rowTotal.append(investmentInfoVo.getTotal()+",");
            if ("合计".equals(investmentInfoVo.getName())){
                for (BigDecimal aLong : investmentInfoVo.getList()) {
                    colTotal.append(aLong.toString()+",");
                }
            }
        }
        projectSubInfo.setId(IdFactory.getUUIDUpper());
        projectSubInfo.setContentJson(investmentInfo);
        projectSubInfo.setTitleJson(itemName);
        projectSubInfo.setRowTotal(rowTotal.toString());
        projectSubInfo.setColTotal(colTotal.toString());
        projectSubInfo.setAddBy(userDtl.getId());
        projectSubInfo.setAddTime(DateUtils.getCurrentDateTime());
        projectSubInfo.setUptBy(userDtl.getId());
        projectSubInfo.setUptTime(DateUtils.getCurrentDateTime());
        //待保存
        /**
         *  项目风险信息处理
         *
         * **/
        List<ProjectRisk> projectRisk = vo.getProjectRisk();
        //待保存
        /**
         * 附件处理
         * */
        List<ProjectAttachment> attachmentList = new ArrayList<>();
        if(vo.getFileAtt()!=null){
            String[] fileAtt = vo.getFileAtt();
            for (String file : fileAtt) {
                ProjectAttachment attachment = createProjectFileAtta(userDtl,proCode,file);
                attachmentList.add(attachment);
            }
        }
        RspVo rspVo = collectProjectService.saveAll(projectInfo,summary,projectSubInfo,projectRisk,attachmentList,collectProject,userDtl,bodyStr,submitType);
        return RspVo.getSuccessResponse(rspVo);
    }


    @RequestMapping("/edit")
    public @ResponseBody RspVo edit(HttpServletRequest request, CollectProject collectProject) {

        String submitType = request.getParameter("submitType");//2=提交  1保存

        String fromChannel = request.getParameter("fromChannel");//项目渠道
        String linkPower = request.getParameter("linkPower");//居住地址
        if (fromChannel.equals("2")) {//居间合作
            if (StringUtils.isEmpty(linkPower)) {
                return ErrorCodeEnum.ERROR_COMMON_CHECK.getRspVo("居间方不能为空");
            }
        }
        String[] sgCoopId = request.getParameterValues("sgCoopId");//单位名称
        String[] coopEffect = request.getParameterValues("coopEffect");//单位作用

        String[] orderIdx = request.getParameterValues("orderIdx");//子项序号
        String[] subName = request.getParameterValues("subName");//子项名称
        String[] subWorkYears = request.getParameterValues("subWorkYears");//子项-合作周期（年）
        String[] subBuildYears = request.getParameterValues("subBuildYears");//子项-建设周期（年）
        String[] subOmYears = request.getParameterValues("subOmYears");//子项-运营周期（年）

        String[] fileAtt1 = request.getParameterValues("fileAtt1");
        String[] fileAtt2 = request.getParameterValues("fileAtt2");
        String[] fileAtt9 = request.getParameterValues("fileAtt9");

        if (sgCoopId != null && sgCoopId.length > 0) {
            for (int i = 0; i < sgCoopId.length; i++ ) {
                String coopId = sgCoopId[i];
                String coopeffect = coopEffect[i];
                if (StringUtils.isNotEmpty(coopId)) {
                    if (StringUtils.isEmpty(coopeffect)) {
                        return ErrorCodeEnum.ERROR_COMMON_CHECK.getRspVo("联合体单位-单位作用未选择");
                    }
                }
                else {
                    if (StringUtils.isNotEmpty(coopeffect)) {
                        return ErrorCodeEnum.ERROR_COMMON_CHECK.getRspVo("联合体单位-单位名称未选择");
                    }
                }
            }
        }

        AuthorizationVO vo = SessionUserUtils.getSessionAttributeForUserDtl();

        /**
         * 项目信息收集主表处理
         */
        String id = collectProject.getId();
        collectProject.setUptBy(vo.getId());
        collectProject.setUptTime(top.infopub.mgr.util.DateUtils.getCurrentDateTime());

        //合作单位处理
        List<CollectProjectCoop> preProjectCoops = new ArrayList<CollectProjectCoop>();
        if (sgCoopId != null && sgCoopId.length > 0) {
            for (int i = 0; i < sgCoopId.length; i++ ) {
                String coopId = sgCoopId[i];
                String coopeffect = coopEffect[i];
                if (StringUtils.isEmpty(coopId) && StringUtils.isEmpty(coopeffect)) {
                    continue;
                }
                String coopid = IdFactory.getUUIDUpper();//自动生成主键
                CollectProjectCoop collectProjectCoop = new CollectProjectCoop();
                collectProjectCoop.setId(coopid);
                collectProjectCoop.setPreProjectId(id);
                collectProjectCoop.setSgCoopId(coopId);
                collectProjectCoop.setCoopEffect(coopeffect);
                collectProjectCoop.setAddBy(vo.getId());
                collectProjectCoop.setAddTime(top.infopub.mgr.util.DateUtils.getCurrentDateTime());
                preProjectCoops.add(collectProjectCoop);
            }

        }

        //子项处理
        List<CollectProjectSub> preProjectSubs = new ArrayList<CollectProjectSub>();
        for (int i = 0; i < orderIdx.length; i++ ) {
            String orderId = orderIdx[i];
            CollectProjectSub collectProjectSub = new CollectProjectSub();
            String subId = IdFactory.getUUIDUpper();//自动生成主键
            collectProjectSub.setId(subId);
            collectProjectSub.setPreProjectId(id);
            collectProjectSub.setOrderIdx(Integer.parseInt(orderId));
            if(StringUtils.isEmpty(subName[i])){
                continue;
            }
            collectProjectSub.setSubName(subName[i]);
            collectProjectSub.setWorkYears(StringUtils.isEmpty(subWorkYears[i])?new BigDecimal(0):new BigDecimal(subWorkYears[i]));
            collectProjectSub.setBuildYears(StringUtils.isEmpty(subBuildYears[i])?new BigDecimal(0):new BigDecimal(subBuildYears[i]));
            collectProjectSub.setOmYears(StringUtils.isEmpty(subOmYears[i])?new BigDecimal(0):new BigDecimal(subOmYears[i]));
            collectProjectSub.setAddBy(vo.getId());
            collectProjectSub.setAddTime(top.infopub.mgr.util.DateUtils.getCurrentDateTime());
            preProjectSubs.add(collectProjectSub);
        }
//        /**
//         * 上传的文件记录加入集合
//         */
//        List<CollectProjectAtt> fileAtts = new ArrayList<CollectProjectAtt>();
//        //项目可研报告
//        if (fileAtt1 != null) {
//            for (String file : fileAtt1) {
//                CollectProjectAtt preProjectAtt = createFileAtt(vo, id, file);
//                fileAtts.add(preProjectAtt);
//            }
//        }
//        //两评一案
//        if (fileAtt2 != null) {
//            for (String file : fileAtt2) {
//                CollectProjectAtt preProjectAtt = createFileAtt(vo, id, file);
//                fileAtts.add(preProjectAtt);
//            }
//        }
//        //其他资料（选填）
//        if (fileAtt9 != null) {
//            for (String file : fileAtt9) {
//                CollectProjectAtt preProjectAtt = createFileAtt(vo, id, file);
//                fileAtts.add(preProjectAtt);
//            }
//        }
//        collectProjectService.editCollectProject(collectProject, preProjectCoops, preProjectSubs, fileAtts,submitType);
//        LogUtil.bizLog(LogUtil.LogModelType.PROJECT, LogUtil.AcctionType.ADD,
//                "项目信息收集-编辑项目信息收集：项目名=" + collectProject.getProName(), null);
        return RspVo.getSuccessResponse();
    }
    public static String[] getNullPropertyNames (Object source) {
        final BeanWrapper src = new BeanWrapperImpl(source);
        java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors();

        Set emptyNames = new HashSet();
        for(java.beans.PropertyDescriptor pd : pds) {
            Object srcValue = src.getPropertyValue(pd.getName());
            if (srcValue == null) {
                emptyNames.add(pd.getName());
            }
        }
        String[] result = new String[emptyNames.size()];
        return (String[]) emptyNames.toArray(result);
    }

    public static void copyPropertiesIgnoreNull(Object src, Object target){
        BeanUtils.copyProperties(src, target, getNullPropertyNames(src));
    }

    /**
     * 跳转审批页面
     *
     */
    @RequestMapping("/toDealOrDetail1")
    public String toDealOrDetail(HttpServletRequest request, String id, String proCode) {
        request.setAttribute("id",id);
        CollectProject collectProject = collectProjectService.selectByPrimaryKey(id);
        request.setAttribute("isAuditFlag", "0");
        if (collectProject != null) {
            if (StringUtils.equals(ProProcesssStatusEnum.PRO_STATUS1.getCode(), collectProject.getProcessStatus())) {
                request.setAttribute("isAuditFlag", "1");
            }
            if (StringUtils.isNotBlank(collectProject.getProcessId()) && collectProject.getProcessId().length() > 10) {
                request.setAttribute("processId", collectProject.getProcessId());
            }
        }
        request.setAttribute("proCode",proCode);
        return "mkt/lay-collectProject-process";
    }
    @RequestMapping("/auditProcess")
    @ResponseBody
    public RspVo auditProcess(String id, String processId, String status, String auditMsg,String isTrack) {

        //项目信息收集审批
        if (StringUtils.isNotBlank(isTrack)){
            proProcessManageService.auditProject(id, processId, status, auditMsg, isTrack);
        }else{
            proProcessManageService.auditProject(id, processId, status, auditMsg, null);
        }
        return RspVo.getSuccessResponse();
    }

    /**
     * 获取项目信息收集页面所需数据
     * **/
    @RequestMapping("/getCollectDomain")
    @ResponseBody
    public RspVo getCollectDomain(){
        //生成项目编码
        CollectDomain collectDomain = new CollectDomain();
        String procode = codeGeneratorConfigService.generatorCode("mkt_pre_project_procode");
        //查找所属公司以及项目经理
        AuthorizationVO userDtl = SessionUserUtils.getSessionAttributeForUserDtl();
        collectDomain = operatorService.selectTail(userDtl.getId());
        collectDomain.setProCode(procode);
        return RspVo.getSuccessResponse(collectDomain);
    }

    /**判断所选城市是否在城市调研存在**/
    @RequestMapping("/checkCity")
    @ResponseBody
    public RspVo checkCity(String address ){
       return citySurveyService.selectByAddress(address);
    }
}
